
package com.insigma.business.qrcode.soldier._provider.impl;


import com.insigma.business.qrcode.common._provider.BaseProviderImpl;
import com.insigma.business.qrcode.soldier.dao.GovEmployeeRoleDao;
import com.insigma.business.qrcode.soldier.dto.GovEmployeeRoleDTO;
import com.insigma.business.qrcode.soldier.entity.GovEmployeeRoleDO;
import com.insigma.business.qrcode.soldier._provider.GovEmployeeRoleProvider;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;


@Slf4j
@Service
@Component("govEmployeeRoleProvider")
public class GovEmployeeRoleProviderImpl extends BaseProviderImpl implements GovEmployeeRoleProvider {

    @Autowired(required = false)
    private GovEmployeeRoleDao govEmployeeRoleDao;




    @Override
    public List<GovEmployeeRoleDTO> getEmployeeRole(String employeeId) {
        List<GovEmployeeRoleDO> doList = govEmployeeRoleDao.listByEmployeeId2(employeeId);
        List<GovEmployeeRoleDTO> listDto = new ArrayList<>();
        //BeanUtils.copyProperties(doList,listDto);
        for (GovEmployeeRoleDO govEmployeeRoleDO : doList){
            GovEmployeeRoleDTO govEmployeeRoleDTO = new GovEmployeeRoleDTO();
            BeanUtils.copyProperties(govEmployeeRoleDO, govEmployeeRoleDTO);
            listDto.add(govEmployeeRoleDTO);
        }
        return listDto;
    }
}
